<include file="Weixin/header" />
<title>开票信息</title>
</head>
<body class="clearfix fp">
    <div class="title clearfix"><a class="tj" href="ucenter.html?func=kaipiaoinfo">添加发票</a></div>
	<?php if(count($invoice)){ ?>
	<?php foreach($invoice as $inv){ ?>
	<div class="item clearfix">
		<?php if($inv['invoice_type'] == 1){ ?>
        <div class="lt bg1">普</div>
		<?php }else{ ?>
		<div class="lt bg2">增</div>
		<?php } ?>
        <div class="rt">
		<a href="ucenter.html?func=kaipiaoinfo&invid={$inv['invoice_id']}">
            <h3>{$inv['invoice_title']}</h3>
            <p>发票类型：<?php if($inv['invoice_type'] == 1){ echo '普通发票';}else if($inv['invoice_type'] == 2){ echo '增值税普票';}else{ echo '增值税专票';}?></p>
            <p>抬头类型：{$inv['invoice_rise'] == 1 ? '个人' : '单位'}</p>
			<?php if($inv['invoice_rise'] != 1){ ?>
			<p>税号：{$inv['invoice_duty']}</p>
			<?php } ?>
		</a>	
            <div class="mr">
				<?php if($inv['is_default']){ ?>
                <img src="__PUBLIC__/weixin/images/quan2.png" invid="{$inv['invoice_id']}" />设为默认
				<?php }else{ ?>
				<img src="__PUBLIC__/weixin/images/quan.png" invid="{$inv['invoice_id']}" />设为默认
				<?php } ?>
            </div>
        </div>
    </div>
	<?php } ?>
	<?php }else{ ?>
	暂无数据
	<?php } ?>
    <script>
        $(".mr img").on("touchend",function () { 
            $(".mr img").attr("src","__PUBLIC__/weixin/images/quan.png");
            $(this).attr("src","__PUBLIC__/weixin/images/quan2.png");
			$.post('ucenter.html',{func: 'kaipiao',invoice_id: $(this).attr('invid')}, function(row){
				if(row){
					layer.msg("设置成功", {icon:1, time:2000});
				}else{
					layer.msg("设置失败", {icon:0, time:2000});
				}
			});
        });
    </script>
</body>
</html>